﻿<!DOCTYPE html>
<!--相关表格 -->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

</head>
<body>
    
<div id="app" v-cloak>   
        <el-form ref="form" :inline="true" label-position="right" label-width="100px" :model="formInline" class="demo-form-inline" style="margin-bottom: 15px;">
            <el-row>
                <el-col  class="head-tool">   
                        <el-button type="primary" @click="onSubmit">{{col.btnSelect}}</el-button>
                        <el-button type="primary" @click="aaa">{{col.btnConfirm}}</el-button>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.RelatedFormNo" :placeholder="GeneralLiftingWorkSafety.RelatedFormNo" size="mini">
                                <template slot="prepend">
                                    {{GeneralLiftingWorkSafety.RelatedFormNo+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                 </el-col>
                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.RelatedPeople" :placeholder="GeneralLiftingWorkSafety.RelatedPeople"  size="mini">
                                <template slot="prepend">
                                    {{GeneralLiftingWorkSafety.RelatedPeople+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
        </el-form>
            <el-row>
                <el-table ref="table" :data="ListItem.tableData"
                          :height="ListItem.tableHeight"
                          border @selection-change="handleSelectionChange" row-style="height:10px"
                          style="width: 100%">
                    <el-table-column type="selection" :reserve-selection="true"
                                     width="55">
                    </el-table-column>
                    <el-table-column prop="RelatedFormName"
                                     :label="GeneralLiftingWorkSafety.RelatedFormName">
                    </el-table-column>
                    <el-table-column prop="RelatedFormNo"
                                     :label="GeneralLiftingWorkSafety.RelatedFormNo">
                    </el-table-column>
                    <el-table-column prop="RelatedPeople"
                                     :label="GeneralLiftingWorkSafety.RelatedPeople"
                                     width="100">
                    </el-table-column>
                    <el-table-column prop="RelatedTime"
                                     :label="GeneralLiftingWorkSafety.RelatedTime" width="150">
                    </el-table-column>
                </el-table>
            </el-row>
            <el-row type="flex" justify="end">
                <el-pagination ref="page" @size-change="handleSizeChange"
                               @current-change="handleCurrentChange"
                               :current-page="ListItem.currentPage"
                               :page-sizes="ListItem.pagesizes"
                               :page-size="ListItem.pagesize"
                               :layout="ListItem.layout"
                               :total="ListItem.total">
                </el-pagination>
            </el-row>
    </div>
    <script type="text/javascript">
        app = new Vue({
            el: '#app',
            id: '',
            data: function () {
                return {
                    ListItem: ListItem,
                    formInline: {
                        model: { RelatedFormNo: '', RelatedPeople: '' },
                        offset: 0,
                        limit: 10
                    }
                }
            }, created: function () {
                var currApp = this;
                window.onresize = function () {
                    currApp.ListItem.tableHeight = window.innerHeight -
                        currApp.$refs.table.$el.offsetTop - 60;
                    if (currApp.ListItem.tableHeight < 112) {
                        currApp.ListItem.tableHeight = 112;
                    }
                }
            },
            mounted: function () {
                this.id = getUrlParam("id");

                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                closeDialog: function () { closeDialog(this); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/GeneralLiftingWorkSafety/RelatedTable') },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                onSubmit: function () { onSubmit(this); },

                aaa: function () {
                    if (this.ListItem.tableMultipleSelection.length!= 1) {
                        showMessage(msg.OnlyOne, 'error')
                        return;
                    }
                    for (var i = 0; i < parent.app.Form.RelatedForm.length; i++) {
                        if (parent.app.Form.RelatedForm[i].id = this.id) {
                            parent.app.Form.RelatedForm.splice(i, 1);
                            break;
                        }
                    }
                    parent.app.Form.RelatedForm.push(this.ListItem.tableMultipleSelection[0])
                    parent.app.ListItem.dialogVisible = false;
                }
            }
        });
    </script>
</body>
</html>